home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / winsweep / winsweep.frm < prev    next >
Text File  |  1995-05-08  |  10KB  |  375 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00C0FFC0&
  5.    Caption         =   "WinSweep 1.3 - (c)1991 Nils Segerdahl"
  6.    ClientHeight    =   4815
  7.    ClientLeft      =   240
  8.    ClientTop       =   1395
  9.    ClientWidth     =   8760
  10.    Height          =   5220
  11.    Icon            =   WINSWEEP.FRX:0000
  12.    Left            =   180
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   4815
  17.    ScaleWidth      =   8760
  18.    Top             =   1050
  19.    Width           =   8880
  20.    Begin FileListBox File1 
  21.       BackColor       =   &H00C0C0C0&
  22.       Height          =   2370
  23.       Hidden          =   -1  'True
  24.       Left            =   7080
  25.       System          =   -1  'True
  26.       TabIndex        =   0
  27.       Top             =   2280
  28.       Width           =   1575
  29.    End
  30.    Begin DirListBox Dir1 
  31.       BackColor       =   &H00C0C0C0&
  32.       Height          =   1575
  33.       Left            =   7080
  34.       TabIndex        =   2
  35.       Top             =   600
  36.       Width           =   1575
  37.    End
  38.    Begin TextBox Text1 
  39.       BackColor       =   &H00FFFFFF&
  40.       ForeColor       =   &H00000000&
  41.       Height          =   4095
  42.       Left            =   120
  43.       MultiLine       =   -1  'True
  44.       ScrollBars      =   3  'Both
  45.       TabIndex        =   1
  46.       Text            =   " "
  47.       Top             =   600
  48.       Width           =   6855
  49.    End
  50.    Begin DriveListBox Drive1 
  51.       BackColor       =   &H00C0C0C0&
  52.       Height          =   315
  53.       Left            =   7320
  54.       TabIndex        =   3
  55.       Top             =   120
  56.       Width           =   1335
  57.    End
  58.    Begin CommandButton Command6 
  59.       Caption         =   "&?"
  60.       Height          =   375
  61.       Left            =   6720
  62.       TabIndex        =   10
  63.       TabStop         =   0   'False
  64.       Top             =   120
  65.       Width           =   375
  66.    End
  67.    Begin CommandButton Command2 
  68.       Caption         =   "&Quit"
  69.       Height          =   375
  70.       Left            =   6000
  71.       TabIndex        =   9
  72.       TabStop         =   0   'False
  73.       Top             =   120
  74.       Width           =   615
  75.    End
  76.    Begin CommandButton Command5 
  77.       Caption         =   "&Run"
  78.       Height          =   375
  79.       Left            =   5400
  80.       TabIndex        =   7
  81.       TabStop         =   0   'False
  82.       Top             =   120
  83.       Width           =   495
  84.    End
  85.    Begin CommandButton Command4 
  86.       Caption         =   "&Copy"
  87.       Height          =   375
  88.       Left            =   4680
  89.       TabIndex        =   6
  90.       TabStop         =   0   'False
  91.       Top             =   120
  92.       Width           =   615
  93.    End
  94.    Begin CommandButton Command3 
  95.       Caption         =   "&Delete"
  96.       Height          =   375
  97.       Left            =   3840
  98.       TabIndex        =   5
  99.       TabStop         =   0   'False
  100.       Top             =   120
  101.       Width           =   735
  102.    End
  103.    Begin CommandButton Command1 
  104.       Caption         =   "&Save"
  105.       Height          =   375
  106.       Left            =   3000
  107.       TabIndex        =   4
  108.       TabStop         =   0   'False
  109.       Top             =   120
  110.       Width           =   735
  111.    End
  112.    Begin TextBox Text2 
  113.       BackColor       =   &H00C0C0C0&
  114.       Height          =   375
  115.       Left            =   600
  116.       TabIndex        =   8
  117.       TabStop         =   0   'False
  118.       Text            =   " "
  119.       Top             =   120
  120.       Width           =   2295
  121.    End
  122.    Begin PictureBox Picture1 
  123.       BackColor       =   &H00C0FFC0&
  124.       BorderStyle     =   0  'None
  125.       Height          =   495
  126.       Left            =   0
  127.       Picture         =   WINSWEEP.FRX:0302
  128.       ScaleHeight     =   495
  129.       ScaleWidth      =   495
  130.       TabIndex        =   11
  131.       TabStop         =   0   'False
  132.       Top             =   0
  133.       Width           =   495
  134.    End
  135. End
  136.  
  137.  
  138. Sub Command1_Click ()
  139.     saveindex = file1.listindex
  140.     If file1.filename = "" Then
  141.     MsgBox "No file selected"
  142.     Exit Sub
  143.     End If
  144.     If (filesize > FILMAX) Then
  145.     MsgBox "File wold be truncated!"
  146.     Exit Sub
  147.     End If
  148.     tmp$ = "Save file " + file1.filename + " ? "
  149.     rep = MsgBox(tmp$, 36, "SAVE File")
  150.     If rep = 6 Then
  151.     tmp$ = file1.filename
  152.     dotpos = InStr(1, tmp$, ".")
  153.     tmp$ = Left$(tmp$, dotpos)
  154.     On Error GoTo errhand
  155.     Kill tmp$ + "bak"
  156.     On Error GoTo 0
  157.     Name file1.filename As tmp$ + "bak"
  158.     Open file1.filename For Binary As #1
  159.     textstr$ = text1.text
  160.     Put #1, , textstr$
  161.     Close #1
  162.     End If
  163.     file1.Refresh
  164.     file1.listindex = saveindex
  165.     file1.SetFocus
  166.     Exit Sub
  167. errhand:
  168.     Resume Next
  169. End Sub
  170.  
  171.  
  172. Sub Command2_Click ()
  173.     tmp$ = "If you like this program, please send" + Chr$(13) + Chr$(10)
  174.     tmp$ = tmp$ + "some money (eg. 25$) to me:" + Chr$(13) + Chr$(10)
  175.     tmp$ = tmp$ + " " + Chr$(13) + Chr$(10)
  176.     tmp$ = tmp$ + "Nils Segerdahl" + Chr$(13) + Chr$(10)
  177.     tmp$ = tmp$ + "PrΣstgσrdsgatan 19B" + Chr$(13) + Chr$(10)
  178.     tmp$ = tmp$ + "S-752 30 Upsala, SWEDEN" + Chr$(13) + Chr$(10)
  179.     tmp$ = tmp$ + " " + Chr$(13) + Chr$(10)
  180.     tmp$ = tmp$ + " " + Chr$(13) + Chr$(10)
  181.     tmp$ = tmp$ + "TERMINATE?" + Chr$(13) + Chr$(10)
  182.     resp% = MsgBox(tmp$, 20, "QUIT")
  183.     If resp% = 6 Then
  184.        End
  185.     End If
  186. End Sub
  187.  
  188. Sub Command3_Click ()
  189.     saveindex = file1.listindex
  190.     If file1.filename = "" Then
  191.     MsgBox "No file selected"
  192.     Exit Sub
  193.     End If
  194.     tmp$ = "Delete file " + file1.filename + " ? "
  195.     rep = MsgBox(tmp$, 36, "Delete File")
  196.     If rep = 6 Then
  197.     Kill file1.filename
  198.     End If
  199.     file1.Refresh
  200.     file1.listindex = saveindex
  201.     file1.SetFocus
  202. End Sub
  203.  
  204. Sub Command4_Click ()
  205.     saveindex = file1.listindex
  206.     If file1.filename = "" Then
  207.     MsgBox "No file selected"
  208.     Exit Sub
  209.     End If
  210.     tmp$ = "Copy " + file1.filename + " to "
  211.     tmp$ = InputBox$(tmp$, "Copy file", "")
  212.     screen.mousepointer = 11
  213.     If Len(tmp$) > 0 Then
  214.        Open file1.filename For Binary As #1
  215.        On Error GoTo errhand_cmd4
  216.        Kill tmp$
  217.        On Error GoTo 0
  218.        Open tmp$ For Binary As #2
  219.        i = LOF(1)
  220.        text2.text = "Copying...."
  221.        For j = 1 To i Step 512
  222.         tmp$ = Input$(512, #1)
  223.         Put #2, j, tmp$
  224.        Next j
  225.        text2.text = "Done"
  226.        Close
  227.     End If
  228.     file1.Refresh
  229.     file1.listindex = saveindex
  230.     file1.SetFocus
  231.     screen.mousepointer = 0
  232.     Exit Sub
  233. errhand_cmd4:
  234.     Resume Next
  235. End Sub
  236.  
  237. Sub Command5_Click ()
  238.     saveindex = file1.listindex
  239.     If file1.filename = "" Then
  240.     MsgBox "No file selected"
  241.     Exit Sub
  242.     End If
  243.     tmp$ = Right$(file1.filename, 4)
  244.     If tmp$ = ".exe" Or tmp$ = ".com" Or tmp$ = ".bat" Then
  245.     res = Shell(file1.filename, 1)
  246.     Else
  247.     MsgBox "File not executable"
  248.     End If
  249.     file1.Refresh
  250.     file1.listindex = saveindex
  251.     file1.SetFocus
  252. End Sub
  253.  
  254. Sub Command6_Click ()
  255.     form2.Show
  256.     
  257. End Sub
  258.  
  259. Sub Dir1_Change ()
  260.     screen.mousepointer = 11
  261.     file1.path = dir1.path
  262.     ChDir dir1.path
  263.     On Error GoTo errh
  264.     file1.listindex = 0
  265.     On Error GoTo 0
  266.     file1.SetFocus
  267.     screen.mousepointer = 0
  268.     Exit Sub
  269.  
  270. errh:
  271.     Resume Next
  272. End Sub
  273.  
  274. Sub Drive1_Change ()
  275.     screen.mousepointer = 11
  276.     dir1.path = drive1.drive
  277.     ChDrive (drive1.drive)
  278.     file1.listindex = 0
  279.     file1.SetFocus
  280.     screen.mousepointer = 0
  281. End Sub
  282.  
  283. Sub errhand ()
  284.  
  285. End Sub
  286.  
  287. Sub File1_Click ()
  288.     screen.mousepointer = 11
  289.     filesize = 0
  290.     txtstr$ = String$(FILMAX, " ")
  291.     If Right$(file1.filename, 4) = ".exe" Then
  292.     text2.text = ".EXE file - Not viewable"
  293.     Beep
  294.     text1.text = " "
  295.     ElseIf Right$(file1.filename, 4) = ".com" Then
  296.     text2.text = ".COM file - Not viewable"
  297.     Beep
  298.     text1.text = " "
  299.     ElseIf Right$(file1.filename, 4) = ".bmp" Then
  300.     text2.text = ".bmp file - Not viewable"
  301.     Beep
  302.     text1.text = " "
  303.     ElseIf Right$(file1.filename, 4) = ".dll" Then
  304.     text2.text = ".DLL file - Not viewable"
  305.     Beep
  306.     text1.text = " "
  307.     ElseIf Right$(file1.f